package com.gientech.springexercise.controller.rocketMQ;

import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * @ClassName Consumer
 * @Description TODO
 * @Author zhangfantong
 * @Date 2023/2/24 22:41
 * @Version 1.0
 */
@Component
@RocketMQMessageListener(topic = "mytopic", consumerGroup = "my-consumer-group")
public class Consumer implements RocketMQListener<String> {
    @Override
    public void onMessage(String s) {
//        获取消息，并在控制台打印（生产者一有消息就接收了）
        System.out.println("Consumer@@@@@接收信息："+s);
    }
}
